<!DOCTYPE html>
<html xmlns:c="http://www.w3.org/1999/html">
<head>
    <meta charset="UTF-8">
    <title>奖助学金管理系统</title>
    <link rel="stylesheet" type="text/css" href="statics/css/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="statics/css/themes/icon.css">
    <link rel="stylesheet" type="text/css" href="statics/css/style.css">
    <link rel="stylesheet" type="text/css" href="statics/css/index.css">
    <link rel="stylesheet" type="text/css" href="statics/js/contextMenu/jquery.contextMenu.css">
    <script type="text/javascript" src="statics/js/jquery.min.js"></script>
    <script type="text/javascript" src="statics/js/underscore-min.js"></script>
    <script type="text/javascript" src="statics/js/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="statics/js/easyui-lang-zh_CN.js"></script>
    <style type="text/css">
    	input {font-family:'Verdana';}
    </style>
</head>
<body>
    <div class="easyui-layout" data-options="fit:true">
        <div data-options="region:'north'" style="height:55px;background: url('statics/images/head_bg2.jpg');background-size: 100% 100%;">
        	<div style="float:left;width:300px;"><img alt="" src="statics/images/head_logo2.png"></div>
        	<div style="float:right;width:300px;margin-top:12px;">
        		<div style="float:right;padding-right:10px;margin-top:8px;"><span style="color:white;" id="userName"></span>您好，欢迎光临 <span style="margin-right:10px;"><a href="javascript:void(0)" onclick="$('#win_cp').window('open');">修改密码</a>|<a href="user/logout">安全退出</a></span></div>
        	</div>
        </div>
        <div data-options="region:'south',split:true" style="height:50px;background: url('statics/images/foot_bg2.jpg');">
        	<div style="margin:10px auto;width:360px;">
		        <!--<a href="javascript:void(0);">关于我们</a> |
		        <a href="javascript:void(0);">加入我们</a> |
		        <a href="javascript:void(0);">广告及服务</a> |
		        <a href="javascript:void(0);">常见问题解答</a> |
		        <a href="javascript:void(0);">提交建议</a>-->
		    </div>
        </div>
        <div data-options="region:'east',split:true" title="&nbsp;" style="width:160px;">
            <div id="menu_list" class="easyui-accordion" data-options="border:false,fit:true">

                <div title="奖助学金管理" data-options="selected:true" style="padding:10px;;">
                	<ul class="easyui-tree" id="scholarshipM" data-options="url:'menu/scholarshipM',onClick:openTab"></ul>
                </div>
                <div title="学生信息管理"  style="padding:10px;">
                    <ul class="easyui-tree" id="studentM" data-options="url:'menu/studentM',onClick:openTab"></ul>
                </div>
                <div title="班级信息管理"  style="padding:10px;">
                    <ul class="easyui-tree" id="collegeM" data-options="url:'menu/collegeM',onClick:openTab"></ul>
                </div>
                <div title="奖助学金监控"  style="padding:10px;">
                    <ul class="easyui-tree" id="managerM" data-options="url:'menu/managerM',onClick:openTab"></ul>
                </div>
                <div title="系统管理"  style="padding:10px;">
                    <ul class="easyui-tree" id="systemM" data-options="url:'menu/systemM',onClick:openTab"></ul>
                </div>

                <!--<div title="发放人管理" style="padding:10px;">
                    <ul class="easyui-tree" id="managerM" data-options="url:'menu/managerM',onClick:openTab"></ul>
                </div>-->
                <div title="个人信息管理" data-options="selected:true" style="padding:10px;">
                    <ul class="easyui-tree" id="personM" data-options="url:'menu/personM',onClick:openTab"></ul>
                </div>
            </div>
        </div>
        <div data-options="region:'center'">
            <div id="tt" class="easyui-tabs" fit="true" border="false" plain="true">
				<div title="欢迎" href="welcome.html"></div>
			</div>
        </div>
    </div>
</body>
<div id="win_cp" class="easyui-window" title="修改密码" style="width:380px;height:200px;padding-left:50px;padding-top:20px;"
        data-options="iconCls:'icon-save',modal:true,closed:true,minimizable:false,collapsible:false,maximizable:false">
  <form id="f_changePwd" action="user/changePwd" method="post">
      <table>
          <tr>
              <td>原密码:</td>
              <td><input name="oldPwd" type="password" class="txtInput"></input></td>
          </tr>
          <tr>
              <td>新密码:</td>
              <td><input name="newPwd" type="password" class="txtInput"></input></td>
          </tr>
          <tr>
              <td>确认密码:</td>
              <td><input name="confirmPwd" type="password" class="txtInput"></input></td>
          </tr>
          <tr>
              <td></td>
              <td><input type="submit" value="确定" class="btnSubmit"></input></td>
          </tr>
      </table>
  </form>
</div>

<script type="text/javascript" src="statics/js/contextMenu/jquery.contextMenu.js"></script>
<script>
function openTab(node){
	if ($('#tt').tabs('exists',node.text)){
		$('#tt').tabs('select', node.text);
	} else {
		$('#tt').tabs('add',{
			title:node.text,
			iconCls:node.iconCls,
			href:node.attributes.url,
			closable:true
		});
	}
}

$(function() {
	$.ajax({
		url:'user/info?v=' + new Date(),
		success:function(info) {
			if(info.user == null || info.userType == null) {//未登陆
				window.location.href = 'login.html';
				return;
			}
			$('#userName').html(info.userType == 1? info.user.xm : info.user.name);

			if(info.userType == 1) {//以下菜单对于学生没有权限
                $('#menu_list')
                        .accordion('remove','班级信息管理')
                        .accordion('remove','学生信息管理')
                        .accordion('remove','奖助学金监控')
                        .accordion('remove','个人信息管理')
                        .accordion('remove','系统管理');
			}

            if(info.userType == 2) {//以下菜单对于发放人没有权限
                $('#menu_list')
                        .accordion('remove','奖助学金监控')
                        .accordion('remove', '系统管理');
            }

            if(info.userType == 3) {//以下菜单对于内控人员没有权限
                $('#menu_list')
                        .accordion('remove','学生信息管理')
                        .accordion('remove','奖助学金管理')
                        .accordion('remove','班级信息管理')
                        .accordion('remove','个人信息管理')
                        .accordion('remove', '系统管理');
            }

            if(info.userType == 4) {//以下菜单对于系统管理员没有权限
                $('#menu_list')
                        .accordion('remove','奖助学金管理')
                        .accordion('remove','班级信息管理')
                        .accordion('remove','学生信息管理')
                        .accordion('remove','奖助学金监控')
                        .accordion('remove','个人信息管理');
            }
		}
	});

	$('#f_changePwd').form({
        success:function(result){
            if($.parseJSON(result).errorInfo == 'none') {
            	$.messager.alert('提示','密码修改成功！');
				$('#win_cp').window('close');
				return ;
            }
            $.messager.alert('提示',$.parseJSON(result).errorInfo);
        }
    });

	$.contextMenu({
		selector:'#tt .tabs-header li:not(:first)',
		className:'cm',
		items: {close:{name:'关闭',icon:'cancel'}},
		callback: function(key ,opts) {
			$(this).find('a:last').click();
		}
	}); 
});
</script>
</html>